package com.sale24h.data;

import java.util.ArrayList;
import java.util.Date;
import java.util.List;

import org.json.JSONArray;
import org.json.JSONException;
import org.json.JSONObject;

public class clsXuatBan
{
	private String mact;
	private Date ngayct;
	private String soct;
	private String makhach;
	private int mathungan;
	private double giatri;
	private double chietkhau;
	private String sohd;
	private String ngayhd;
	private double giatrithue;
	private double phiphucvu;
	private String giolapbil;
	private String soban;
	private int sokhach;
	private String calamviec;
	private String mapc;
	private String hinhthuctt;
	private Boolean update;
	private String gioketthuc;
	private String sothe;
	private int billdup;
	
	private List<clsChiTietBan> chitietbans;
	public String getMact()
	{
		return mact;
	}
	public void setMact(String mact)
	{
		this.mact = mact;
	}
	public Date getNgayct()
	{
		return ngayct;
	}
	public void setNgayct(Date ngayct)
	{
		this.ngayct = ngayct;
	}
	public String getSoct()
	{
		return soct;
	}
	public void setSoct(String soct)
	{
		this.soct = soct;
	}
	public String getMakhach()
	{
		return makhach;
	}
	public void setMakhach(String makhach)
	{
		this.makhach = makhach;
	}
	public int getMathungan()
	{
		return mathungan;
	}
	public void setMathungan(int mathungan)
	{
		this.mathungan = mathungan;
	}
	public double getGiatri()
	{
		return giatri;
	}
	public void setGiatri(double giatri)
	{
		this.giatri = giatri;
	}
	public double getChietkhau()
	{
		return chietkhau;
	}
	public void setChietkhau(double chietkhau)
	{
		this.chietkhau = chietkhau;
	}
	public String getSohd()
	{
		return sohd;
	}
	public void setSohd(String sohd)
	{
		this.sohd = sohd;
	}
	public String getNgayhd()
	{
		return ngayhd;
	}
	public void setNgayhd(String ngayhd)
	{
		this.ngayhd = ngayhd;
	}
	public double getGiatrithue()
	{
		return giatrithue;
	}
	public void setGiatrithue(double giatrithue)
	{
		this.giatrithue = giatrithue;
	}
	public double getPhiphucvu()
	{
		return phiphucvu;
	}
	public void setPhiphucvu(double phiphucvu)
	{
		this.phiphucvu = phiphucvu;
	}
	public String getGiolapbil()
	{
		return giolapbil;
	}
	public void setGiolapbil(String giolapbil)
	{
		this.giolapbil = giolapbil;
	}
	public String getSoban()
	{
		return soban;
	}
	public void setSoban(String soban)
	{
		this.soban = soban;
	}
	public int getSokhach()
	{
		return sokhach;
	}
	public void setSokhach(int sokhach)
	{
		this.sokhach = sokhach;
	}
	public String getCalamviec()
	{
		return calamviec;
	}
	public void setCalamviec(String calamviec)
	{
		this.calamviec = calamviec;
	}
	public String getMapc()
	{
		return mapc;
	}
	public void setMapc(String mapc)
	{
		this.mapc = mapc;
	}
	public String getHinhthuctt()
	{
		return hinhthuctt;
	}
	public void setHinhthuctt(String hinhthuctt)
	{
		this.hinhthuctt = hinhthuctt;
	}
	public Boolean getUpdate()
	{
		return update;
	}
	public void setUpdate(Boolean update)
	{
		this.update = update;
	}
	public String getGioketthuc()
	{
		return gioketthuc;
	}
	public void setGioketthuc(String gioketthuc)
	{
		this.gioketthuc = gioketthuc;
	}
	public String getSothe()
	{
		return sothe;
	}
	public void setSothe(String sothe)
	{
		this.sothe = sothe;
	}
	public int getBilldup()
	{
		return billdup;
	}
	public void setBilldup(int billdup)
	{
		this.billdup = billdup;
	}
	
	public clsXuatBan()
	{
		chitietbans=new ArrayList<clsChiTietBan>();
	}
	public void ApplyfromJSON(JSONObject obj) throws JSONException
	{
		this.mact=obj.getString("mact");
		this.soban=obj.getString("soban");
		this.sokhach=obj.getInt("sokhach");
		
		// apply chi tiet ban from json to real object
		JSONArray ctbans=obj.getJSONArray("chitietbans");
		
		for(int i=0;i<ctbans.length();i++)
		{
			JSONObject c=ctbans.getJSONObject(i);
			clsChiTietBan ctbobj=new clsChiTietBan();
			ctbobj.ApplyfromJSON(c);
			
			chitietbans.add(ctbobj);
		}
		
	}
	public List<clsChiTietBan> getChitietbans()
	{
		return chitietbans;
	}	
}
